package Homework;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class Test7 {
    public static void main(String[] args) throws IOException {
        Scanner scan = new Scanner(System.in);
        System.out.println("请您输入将要打印的字符：");
        FileOutputStream fos = new FileOutputStream("./Stringdemo_2.txt",true);
        String line = "";
        while(!line.equals("exit")){
            line = scan.nextLine();
            fos.write(line.getBytes(StandardCharsets.UTF_8));
        }
        fos.close();
    }
}
